package com.prototype.demo.weekLog;

/**
 * Created by Administrator on 2017/6/8.
 * 浅克隆(ShallowClone)和深克隆
 * (DeepClone)。在Java语言中，数据类型分为值类型（基本数据类型）和引用类型，值类型包括
 * int、double、byte、boolean、char等简单数据类型，引用类型包括类、接口、数组等复杂类
 * 型。浅克隆和深克隆的主要区别在于是否支持引用类型的成员变量的复制
 *
 */
public class Client {

    public static void main(String[] args) {
        WeekLog log_previous = new WeekLog();
        log_previous.setName("张无忌");
        log_previous.setDate("第12周");
        log_previous.setContent("这周很忙，每天都加班！");

        System.out.println("***********周报**********");
        System.out.println("周次：" + log_previous.getDate());
        System.out.println("姓名：" + log_previous.getName());
        System.out.println("内容：" + log_previous.getContent());
        System.out.println("---------------------------");


        WeekLog log_new;
        log_new = log_previous.Clone();
        log_new.setDate("第13周");
        System.out.println("***********周报**********");
        System.out.println("周次：" + log_new.getDate());
        System.out.println("姓名：" + log_new.getName());
        System.out.println("内容：" + log_new.getContent());

        System.out.println(log_previous == log_new);
        System.out.println(log_previous.getDate() == log_new.getDate());
        System.out.println(log_previous.getName() == log_new.getName());
        System.out.println(log_previous.getContent() == log_new.getContent());
    }
}
